<script setup lang="ts">
import { computed } from 'vue'

interface Props {
  disabled: boolean
}
const props = defineProps<Props>()
interface Emits {
  (name: 'on-preview'): void
  (name: 'on-del'): void
}
const emit = defineEmits<Emits>()
const actions = computed(() => {
  return [
    {
      text: '查看处方',
      disabled: props.disabled
    },
    {
      text: '删除订单'
    }
  ]
})

const onSelect = (action: any, index: number) => {
  if (index === 0) emit('on-preview')
  if (index === 1) emit('on-del')
}
</script>

<template>
  <div class="cp-consult-more">
    <van-popover placement="top-start" :actions="actions" @select="onSelect">
      <template #reference> 更多 </template>
    </van-popover>
  </div>
</template>

<style lang="scss" scoped>
.cp-consult-more {
  flex: 1;
  color: var(--cp-tag);
}
</style>
